package cn.wolfcode.crm.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;


public abstract class JSONUtil {
    private static ObjectMapper mapper = new ObjectMapper();
    //将获取的对象转换成json 格式
    public static String toJSONString(Object obj){
        try {
            return mapper.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            //如果有异常则将异常信息抛出
            throw new RuntimeException(e);
        }
    }

}

